package com.android.webserver.fwapi;


import java.net.HttpURLConnection;

import android.content.Context;

public class Redirection extends WebPage
{
	private String redirectTo;
	
	public Redirection(Context context, Request request)
	{
		super(context, request);
	}

	@Override
	protected boolean create(Object... objects)
	{
		if (objects.length != 1)
			return false;
		redirectTo =(String)objects[0];
		return true;
	}

	@Override
	protected void finish()
	{
		header("Location: " + redirectTo);
		setHTTPStatusCode(HttpURLConnection.HTTP_MOVED_PERM);
	}

}
